home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / GFXFX2.ZIP / MOUSTEST.PAS < prev    next >
Pascal/Delphi Source File  |  1995-02-14  |  2KB  |  51 lines

  1.  
  2. program moustest; { MOUSTEST.PAS }
  3. { Demonstration of the mouse unit - also check MiniGame, by Bas van Gaalen }
  4. uses u_mouse,u_txt,u_misc,u_kb;
  5. var tmp:string; c,x,y:byte; escape:boolean;
  6. begin
  7.   if not mouseinstalled then begin
  8.     writeln('No mouse installed'); halt; end;
  9.   getmouseversion;
  10.   setscr; nwindow(2,2,21,10,' mouse parms ',pos_hi+pos_mi,
  11.     _lightgray+lightcyan,_lightgray+darkgray,darkgray);
  12.   nwindow(40,2,79,v_lines-2,'',0,0,lightgray,0);
  13.   tm_mousewindow(41,3,78,v_lines-3); { mouse window }
  14.   setmousepos(60 shl 3,v_lines shl 2);
  15.   randomize; { generate garbage text in window }
  16.   for y:=3 to v_lines-3 do begin
  17.     for x:=41 to 78 do begin
  18.       c:=random(60);
  19.       if c>52 then dspchar(' ',x,y,lightgray) { generate space }
  20.       else dspchar(chr(ord('a')+c shr 1),x,y,lightgray); { random char }
  21.     end;
  22.   end;
  23.   tm_showmouse;
  24.   nwindow(70,v_lines-6,77,v_lines-4,'',0,0,_blue+lightcyan,darkgray);
  25.   dspat('EXIT',72,v_lines-5,_blue+lightcyan);
  26.   dspmul(#0#112+'version : '+#0#113+hexbyte(verhi)+'.'+hexbyte(verlo),3,3);
  27.   dspmul(#0#112+'type    : '+#0#113+mtypes[mousetype],3,4);
  28.   dspmul(#0#112+'buttons : '+#0#113+lz(buttons,0),3,5);
  29.   escape:=false;
  30.   repeat
  31.     dspmul(#0#112+'x       : '+#0#113+lz(getmousex shr 3,2),3,6);
  32.     dspmul(#0#112+'y       : '+#0#113+lz(getmousey shr 3,2),3,7);
  33.     fillchar(tmp,sizeof(tmp),0);
  34.     if leftpressed then tmp:='left ';
  35.     if middlepressed then tmp:=tmp+'middle ';
  36.     if rightpressed then tmp:=tmp+'right';
  37.     tmp[0]:=#18;
  38.     dspat(tmp,3,8,_lightgray+blue);
  39.     if leftpressed then begin
  40.       fillchar(tmp,sizeof(tmp),0);
  41.       tmp:=copy(tm_getstratcursor(18),1,18);
  42.       tmp[0]:=#18;
  43.       dspat(tmp,3,9,_lightgray+blue);
  44.       tmp:=copy(tmp,1,4);
  45.       escape:=strdn(tmp)='exit';
  46.     end;
  47.   until escape;
  48.   tm_hidemouse;
  49.   getscr;
  50. end.
  51.